home *** CD-ROM | disk | FTP | other *** search
- on setBarMode whichOne
- global oStoryteller, oPuppeteer
- cursorOff()
- set oldMode to getState(oStoryteller, #BarMode)
- if whichOne = #power then
- set buttonStack to getProp(the lsMultiFrames of oPuppeteer, #barButtons)
- set multiFrameSprite to 0
- repeat with i = 10 to 48
- if getPos(buttonStack, the castNum of sprite i) then
- set multiFrameSprite to i
- exit repeat
- end if
- end repeat
- set the castNum of sprite multiFrameSprite to cast getAt(buttonStack, 6)
- startTimer()
- updateStage()
- if oldMode = #runOFF then
- set newMode to #runON
- end if
- if oldMode = #runON then
- set newMode to #runOFF
- end if
- if oldMode = #setOFF then
- set newMode to #setON
- end if
- if oldMode = #setON then
- set newMode to #setOFF
- end if
- repeat while the timer < 2
- nothing()
- end repeat
- set the castNum of sprite multiFrameSprite to cast getAt(buttonStack, 2)
- else
- set buttonStack to getProp(the lsMultiFrames of oPuppeteer, #barSwitch)
- set multiFrameSprite to 0
- repeat with i = 10 to 48
- if getPos(buttonStack, the castNum of sprite i) then
- set multiFrameSprite to i
- exit repeat
- end if
- end repeat
- if oldMode = #runOFF then
- set newMode to #setOFF
- end if
- if oldMode = #runON then
- set newMode to #setON
- end if
- if oldMode = #setOFF then
- set newMode to #runOFF
- end if
- if oldMode = #setON then
- set newMode to #runON
- end if
- end if
- if newMode = #runON then
- if (getState(oStoryteller, #BarLevel) = 6) and (getState(oStoryteller, #BarGain) = 5) and (getState(oStoryteller, #BarFM) = 8) then
- setState(oStoryteller, #BarOnline, 1)
- setInitialHauntDelay()
- end if
- end if
- setProp(the lsStateData of oStoryteller, #BarMode, list(newMode))
- if whichOne = #power then
- set the castNum of sprite multiFrameSprite to cast getAt(buttonStack, 6)
- else
- set the castNum of sprite multiFrameSprite to cast getProp(buttonStack, getState(oStoryteller, #BarMode))
- end if
- updateStage()
- updateDisplay(oPuppeteer)
- if getState(oStoryteller, #BarOnline) = 1 then
- soundEffect(#BARwarmup)
- preLoadCast(1329)
- loadMultiFrames(#barStartPix)
- wait(#soundStop, #BARwarmup)
- pushVideo()
- wait(#videoStop)
- goTo(#LivingRmBarCU2, #backOff)
- updateDisplay(oPuppeteer)
- wait(120)
- goTo(#LivingRmBarMedW, #backOff)
- updateDisplay(oPuppeteer)
- updateStage()
- setState(oStoryteller, #PeekDisplay, #BARstartup)
- unFreezeInventory()
- peekAlert()
- end if
- end
-
- on setBarSelection
- global oStoryteller, oPuppeteer
- cursorOff()
- set buttonStack to getProp(the lsMultiFrames of oPuppeteer, #barButtons)
- set multiFrameSprite to 0
- repeat with i = 10 to 48
- if getPos(buttonStack, the castNum of sprite i) then
- set multiFrameSprite to i
- exit repeat
- end if
- end repeat
- set the castNum of sprite multiFrameSprite to cast getAt(buttonStack, 3)
- updateStage()
- if getState(oStoryteller, #BarMode) = #setON then
- set selectionList to [#level, #gain, #FM]
- set oldPosition to getPos(selectionList, getState(oStoryteller, #BarSelection))
- set newPosition to (oldPosition mod 3) + 1
- setProp(the lsStateData of oStoryteller, #BarSelection, list(getAt(selectionList, newPosition)))
- set the castNum of sprite multiFrameSprite to cast getAt(buttonStack, 2)
- set buttonStack to getProp(the lsMultiFrames of oPuppeteer, #barDash)
- set dashSprite to 0
- repeat with i = 10 to 48
- if getPos(buttonStack, the castNum of sprite i) then
- set dashSprite to i
- exit repeat
- end if
- end repeat
- set the castNum of sprite dashSprite to getAt(buttonStack, newPosition)
- updateStage()
- else
- wait(2)
- set the castNum of sprite multiFrameSprite to cast getAt(buttonStack, 2)
- updateStage()
- end if
- end
-
- on adjustBarSettings upOrDown
- global oStoryteller, oPuppeteer
- cursorOff()
- set whichSetting to getState(oStoryteller, #BarSelection)
- if whichSetting = #level then
- set digitStack to getProp(the lsMultiFrames of oPuppeteer, #levelDigits)
- end if
- if whichSetting = #gain then
- set digitStack to getProp(the lsMultiFrames of oPuppeteer, #gainDigits)
- end if
- if whichSetting = #FM then
- set digitStack to getProp(the lsMultiFrames of oPuppeteer, #FMdigits)
- end if
- set digitSprite to 0
- repeat with i = 10 to 48
- if getPos(digitStack, the castNum of sprite i) then
- set digitSprite to i
- exit repeat
- end if
- end repeat
- set buttonStack to getProp(the lsMultiFrames of oPuppeteer, #barButtons)
- set buttonSprite to 0
- repeat with i = 10 to 48
- if getPos(buttonStack, the castNum of sprite i) then
- set buttonSprite to i
- exit repeat
- end if
- end repeat
- startTimer()
- if upOrDown = #up then
- set the castNum of sprite buttonSprite to cast getAt(buttonStack, 4)
- end if
- if upOrDown = #down then
- set the castNum of sprite buttonSprite to cast getAt(buttonStack, 5)
- end if
- updateStage()
- startTimer()
- set lagTime to 0
- repeat while the stillDown or (the timer < 2)
- if getState(oStoryteller, #BarMode) = #setON then
- if the timer > lagTime then
- if whichSetting = #level then
- set currentLevel to getState(oStoryteller, #BarLevel)
- if upOrDown = #up then
- set newLevel to (currentLevel + 11) mod 10
- end if
- if upOrDown = #down then
- set newLevel to (currentLevel + 9) mod 10
- end if
- set frameStack to getProp(the lsMultiFrames of oPuppeteer, #levelDigits)
- setProp(the lsStateData of oStoryteller, #BarLevel, list(newLevel))
- end if
- if whichSetting = #gain then
- set currentLevel to getState(oStoryteller, #BarGain)
- if upOrDown = #up then
- set newLevel to (currentLevel + 11) mod 10
- end if
- if upOrDown = #down then
- set newLevel to (currentLevel + 9) mod 10
- end if
- set frameStack to getProp(the lsMultiFrames of oPuppeteer, #gainDigits)
- setProp(the lsStateData of oStoryteller, #BarGain, list(newLevel))
- end if
- if whichSetting = #FM then
- set currentLevel to getState(oStoryteller, #BarFM)
- if upOrDown = #up then
- set newLevel to (currentLevel + 11) mod 10
- end if
- if upOrDown = #down then
- set newLevel to (currentLevel + 9) mod 10
- end if
- set frameStack to getProp(the lsMultiFrames of oPuppeteer, #FMdigits)
- setProp(the lsStateData of oStoryteller, #BarFM, list(newLevel))
- end if
- set the castNum of sprite digitSprite to getProp(digitStack, newLevel)
- updateStage()
- set lagTime to lagTime + 30
- end if
- end if
- end repeat
- set the castNum of sprite buttonSprite to cast getAt(buttonStack, 2)
- updateStage()
- end
-
- on setcurrentPageInRealms suggestion
- global oStoryteller, oPuppeteer, gOriginPoint
- cursorOff()
- set frameStack to getProp(the lsMultiFrames of oPuppeteer, #Realms)
- set pageList to [0, 1, 3, 5, 7, 19, 21, 35, 37, 51, 53, 79, 81, 83]
- set currentPage to getState(oStoryteller, #currentPageInRealms)
- set bookMark to getPos(pageList, currentPage)
- if suggestion = #next then
- if bookMark = count(pageList) then
- setState(oStoryteller, #playerIsReadingRealms, 0)
- updateDisplay(oPuppeteer)
- else
- set pageSprite to 0
- set shadowSprite to 0
- repeat with guess = 10 to 48
- if getPos(frameStack, the castNum of sprite guess) then
- set shadowSprite to guess
- set pageSprite to guess + 1
- exit repeat
- end if
- end repeat
- set myLocation to the loc of sprite pageSprite
- set the castNum of sprite shadowSprite to the castNum of sprite pageSprite
- set the loc of sprite pageSprite to point(300, -300) + gOriginPoint
- updateStage()
- do("puppetTransition " & getProp(getProp(the lsMachineProfile of oPuppeteer, #transitions), #nextPage))
- setProp(the lsStateData of oStoryteller, #currentPageInRealms, list(getAt(pageList, bookMark + 1)))
- set the castNum of sprite pageSprite to getAt(frameStack, bookMark + 3)
- set the loc of sprite pageSprite to myLocation
- if getPos([5, 7, 9, 11], bookMark) then
- soundEffect(#multiPages)
- else
- soundEffect(#pageTurn)
- end if
- updateStage()
- end if
- if bookMark = 1 then
- updateDisplay(oPuppeteer)
- end if
- end if
- if suggestion = #previous then
- if bookMark = 1 then
- setState(oStoryteller, #playerIsReadingRealms, 0)
- updateDisplay(oPuppeteer)
- else
- set pageSprite to 0
- set shadowSprite to 0
- repeat with guess = 10 to 48
- if getPos(frameStack, the castNum of sprite guess) then
- set shadowSprite to guess
- set pageSprite to guess + 1
- exit repeat
- end if
- end repeat
- set myLocation to the loc of sprite pageSprite
- set the castNum of sprite shadowSprite to the castNum of sprite pageSprite
- set the loc of sprite pageSprite to point(300, -300) + gOriginPoint
- updateStage()
- do("puppetTransition " & getProp(getProp(the lsMachineProfile of oPuppeteer, #transitions), #prevPage))
- setProp(the lsStateData of oStoryteller, #currentPageInRealms, list(getAt(pageList, bookMark - 1)))
- set the castNum of sprite pageSprite to getAt(frameStack, bookMark + 1)
- set the loc of sprite pageSprite to myLocation
- if getPos([6, 8, 10, 12], bookMark) then
- soundEffect(#multiPages)
- else
- soundEffect(#pageTurn)
- end if
- updateStage()
- end if
- if bookMark = 2 then
- updateDisplay(oPuppeteer)
- end if
- end if
- if integerp(suggestion) then
- do("puppetTransition " & getProp(getProp(the lsMachineProfile of oPuppeteer, #transitions), #nextPage))
- setProp(the lsStateData of oStoryteller, #currentPageInRealms, list(suggestion))
- soundEffect(#multiPages)
- updateDisplay(oPuppeteer)
- end if
- end
-
- on setplayerIsReadingRealms suggestion
- global oStoryteller, oPuppeteer, gFreezeInventory
- setProp(the lsStateData of oStoryteller, #playerIsReadingRealms, list(suggestion))
- if suggestion = 1 then
- setProp(the lsStateData of oStoryteller, #currentPageInRealms, [0])
- setTransition(oPuppeteer, #fadeIn)
- else
- setProp(the lsStateData of oStoryteller, #currentPageInRealms, [1])
- setTransition(oPuppeteer, #fadeIn)
- end if
- end
-
- on setInitialHauntDelay
- global oStoryteller
- set lsDelays to [#DEFAULT: 60, #gettingLate: 45, #veryLate: 30]
- set mileStonesReached to 0
- if inState(#hauntsRemaining, #gazebo1) = 0 then
- set mileStonesReached to mileStonesReached + 1
- end if
- if getState(oStoryteller, #playerHasVideotape) = #usedUp then
- set mileStonesReached to mileStonesReached + 1
- end if
- if getState(oStoryteller, #playerHasCrowbar) = #usedUp then
- set mileStonesReached to mileStonesReached + 1
- end if
- if getState(oStoryteller, #playerHasOscillator) = #usedUp then
- set mileStonesReached to mileStonesReached + 1
- end if
- if inState(#hauntsRemaining, #mirrorMessage) = 0 then
- set mileStonesReached to mileStonesReached + 1
- end if
- if mileStonesReached < 4 then
- set newDelay to getProp(lsDelays, #DEFAULT)
- end if
- if mileStonesReached = 4 then
- set newDelay to getProp(lsDelays, #gettingLate)
- end if
- if mileStonesReached = 5 then
- set newDelay to getProp(lsDelays, #veryLate)
- end if
- setProp(the lsStateData of oStoryteller, #hauntDelay, [newDelay])
- setProp(the lsStateData of oStoryteller, #moveCount, [0])
- end
-